package com.koron.css2.newProjectCenter.impl;

import com.koron.css2.ServerInterface;
import com.koron.css2.newProjectCenter.bean.query.PjDelayQuery;
import com.koron.css2.newProjectCenter.mapper.PjDelayMapper;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.css2.serviceManage.utils.JsonUtils;
import com.koron.util.Constant;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;

public class PjDelayDelete implements ServerInterface {
    @Override
    public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
        try {
            PjDelayQuery pjDelayQuery = JsonUtils.objectToPojo(req.getData(),PjDelayQuery.class);
            PjDelayMapper pjDelayMapper = factory.getMapper(PjDelayMapper.class);

            pjDelayMapper.deleteById(pjDelayQuery.getId());

            return MessageBean.create(Constant.MESSAGE_INT_SUCCESS,"延期删除成功",null);
        } catch (Exception e) {
            logger.error("延期删除失败",e);
            return MessageBean.create(Constant.MESSAGE_INT_FAIL,"延期删除失败",null);
        }
    }
}
